<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!--js报错不提示，此时需要用浏览器的控制台查看错误原因，并可以点击链接
    查看具体位置-->

<input type="text" placeholder="姓名" id="i1">
<input type="text" placeholder="工资" id="i2">
<input type="text" placeholder="工作" id="i3">
<input type="button" value="添加" onclick="f()">

<table border="1">
    <caption>列表</caption>
    <tr>
        <th>姓名</th>
        <th>工资</th>
        <th>工作</th>
    </tr>
</table>

<script>
    let i1 = document.querySelector("#i1")
    let i2 = document.querySelector("#i2");
    let i3 = document.querySelector("#i3");
    let table = document.querySelector("table");

    function f(){
        let tr = document.createElement("tr")
        let th1 = document.createElement("td")
        let th2 = document.createElement("td")
        let th3 = document.createElement("td")

        th1.innerText = i1.value
        th2.innerText = i2.value
        th3.innerText = i3.value

        tr.append(th1,th2,th3)
        table.append(tr)
    }

</script>
</body>
</html>